<form id="form-product" method="post" data-oc-toggle="ajax" data-oc-load="{{ action }}" data-oc-target="#product">
	<div class="table-responsive">
		<table class="table table-bordered table-hover">
			<thead>
				<tr>
					<td class="text-center" style="width: 1px;"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', $(this).prop('checked'));" class="form-check-input"/></td>
					<td class="text-center">{{ column_image }}</td>
					<td class="text-start"><a href="{{ sort_name }}"{% if sort == 'pd.name' %} class="{{ order|lower }}"{% endif %}>{{ column_name }}</a></td>
					<td class="text-start d-none d-lg-table-cell"><a href="{{ sort_model }}"{% if sort == 'p.model' %} class="{{ order|lower }}"{% endif %}>{{ column_model }}</a></td>
					<td class="text-end"><a href="{{ sort_price }}"{% if sort == 'p.price' %} class="{{ order|lower }}"{% endif %}>{{ column_price }}</a></td>
					<td class="text-end"><a href="{{ sort_quantity }}"{% if sort == 'p.quantity' %} class="{{ order|lower }}"{% endif %}>{{ column_quantity }}</a></td>
					<td class="text-end">{{ column_action }}</td>
				</tr>
			</thead>
			<tbody>
				{% if products %}
					{% for product in products %}
						<tr{% if not product.variant %} class="table-warning"{% endif %}>
							<td class="text-center"><input type="checkbox" name="selected[]" value="{{ product.product_id }}" class="form-check-input"/></td>
							<td class="text-center"><img src="{{ product.image }}" alt="{{ product.name }}" class="img-thumbnail"/></td>
							<td class="text-start">{{ product.name }}
								<br/>
								{% if product.status %}
									<small class="text-success">{{ text_enabled }}</small>
								{% else %}
									<small class="text-danger">{{ text_disabled }}</small>
								{% endif %}</td>
							<td class="text-start d-none d-lg-table-cell">{{ product.model }}</td>
							<td class="text-end">
								{% if product.special %}<span style="text-decoration: line-through;">{{ product.price }}</span>
									<br/>
									<div class="text-danger">{{ product.special }}</div>
								{% else %}
									{{ product.price }}
								{% endif %}</td>
							<td class="text-end">
								{% if product.quantity <= 0 %}
									<span class="badge bg-warning">{{ product.quantity }}</span>
								{% elseif product.quantity <= 5 %}
									<span class="badge bg-danger">{{ product.quantity }}</span>
								{% else %}
									<span class="badge bg-success">{{ product.quantity }}</span>
								{% endif %}</td>
							<td class="text-end">
								{% if product.variant %}
									<div class="btn-group">
										<a href="{{ product.edit }}" data-bs-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fas fa-pencil-alt"></i></a>
										<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"><i class="fas fa-caret-down"></i></button>
										<div class="dropdown-menu dropdown-menu-right"><a href="{{ product.variant }}" class="dropdown-item"><i class="fas fa-plus"></i> {{ text_variant_add }}</a></div>
									</div>
								{% else %}
									<a href="{{ product.edit }}" data-bs-toggle="tooltip" title="{{ button_edit }}" class="btn btn-warning"><i class="fas fa-pencil-alt"></i></a>
								{% endif %}
							</td>
						</tr>
					{% endfor %}
				{% else %}
					<tr>
						<td class="text-center" colspan="7">{{ text_no_results }}</td>
					</tr>
				{% endif %}
			</tbody>
		</table>
		</div>
		<div class="row">
			<div class="col-sm-6 text-start">{{ pagination }}</div>
			<div class="col-sm-6 text-end">{{ results }}</div>
		</div>
</form>
